﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using CLibArtreve.bll;

namespace WebAppArtreve.views.shared.components.arts
{
    public partial class WUCArtImages : System.Web.UI.UserControl
    {
        //VARIABLES        
        private string _artPictureName;
        private string _connectionString
        {
            get
            {
                return ConfigurationManager.ConnectionStrings["ARTREVEConnectionString"].ConnectionString;
            }
        }
        
        //PROPERTIES
        public string ArtPictureName
        {
            get
            {
                return this.ViewState["ArtPictureName"] as string;
            }
            set
            {
                _artPictureName = value;
                this.ViewState["ArtPictureName"] = _artPictureName;
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
        }

        //GET THE URL FOR THE IMAGE (WEBCONFIG->DMSPATH + FILENAME)
        protected string GetRealImageURL(string argument)
        {
            /*if (ArtPictureName != null && ArtPictureName != "")
                argument = ArtPictureName;*/

            return ConfigurationManager.AppSettings["DMSPATH"] + argument;
        }

        protected void ODSArtImagesALL_OnObjectCreating(object sender, ObjectDataSourceEventArgs e)
        {
            //STEP 2. CREATE BLL
            ArtPictureBLL ObjectInstance = new ArtPictureBLL(_connectionString);
            //STEP 3. CONNECT TYPENAME
            e.ObjectInstance = ObjectInstance;
        }

    }
}